import json
import requests
import execjs
import time
headers = {
    "accept": "application/json, text/plain, */*",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,ar;q=0.7",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "priority": "u=1, i",
    "referer": "https://www.fnscore.cn/score-csgo.html",
    "sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": '"Windows"',
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0",
    "x-requested-with": "XMLHttpRequest",
}
cookies = {
    "Hm_lvt_cadcf695428f7859d9d5e5d7bd270572": "1751009327",
    "HMACCOUNT": "3080A53B2C8D52B9",
    "SHOW_ACTIVITY_PANEL": "false",
    "Hm_lpvt_cadcf695428f7859d9d5e5d7bd270572": "1751009480",
}
timestamp = int(time.time() * 1000)
url = "https://www.fnscore.cn/api/score/getListByDate"
t=f"timestamp={timestamp}&secret=KHVheWluZ18zZWNyZXRfYXBB"
sign = execjs.compile(open("main.js").read()).call("get_sign", t)

print(sign)
params = {
    "gameType": "3",
    "date": "2025-06-26",
    "hot": "false",
    "onlyAnchor": "false",
    "token": "",
    "timestamp": str(timestamp),
    "sign": sign,
}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
print(response)
